function displayCurrentTime() {
    // 获取当前时间并格式化
    const now = new Date();
    const hours = String(now.getHours()).padStart(2, '0');
    const minutes = String(now.getMinutes()).padStart(2, '0');
    const seconds = String(now.getSeconds()).padStart(2, '0');
    
    // 更新div内容
    document.getElementById('clock').innerText = `${hours}:${minutes}:${seconds}`;
}

// 初始化显示时间
displayCurrentTime();

// 每隔一秒更新一次时间
setInterval(displayCurrentTime, 1000);